package com.github.postsanf.yinian.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.constants.ACTIONs;
import com.github.postsanf.yinian.constants.YNSingleton;
import com.umeng.analytics.MobclickAgent;

public class AlbumStatusIntentActivity extends Activity {
    private boolean isOfficialAlbum;
    private TextView tv_contributre;
    private LinearLayout pp_timecard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_album_status_intent);
        initView();
    }

    private void initView() {
        findViewById(R.id.pp_mcard).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AlbumStatusIntentActivity.this, LocalMemoryCardManageActivity.class));
                Intent statintent = new Intent(ACTIONs.record);
                statintent.putExtra("key", "recordCard_4");
                statintent.putExtra("value", 1);
                sendBroadcast(statintent);
                finish();
            }
        });
        findViewById(R.id.pp_timecard).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AlbumStatusIntentActivity.this, LocalTimeCardManageActivity.class));
                finish();
            }
        });
        findViewById(R.id.pp_uploadphoto).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AlbumStatusIntentActivity.this, LocalManageActivity.class));
                finish();
            }
        });
        findViewById(R.id.intent_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        findViewById(R.id.pp_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        tv_contributre = ((TextView) findViewById(R.id.tv_contributre));
        pp_timecard = ((LinearLayout) findViewById(R.id.pp_timecard));
        isOfficialAlbum = (YNSingleton.getInstance().getCurAlbum().getGtype().equals(getString(R.string.gfxc)));
        if (isOfficialAlbum) {
            tv_contributre.setVisibility(View.VISIBLE);
            pp_timecard.setVisibility(View.GONE);
        } else {
            tv_contributre.setVisibility(View.GONE);
            pp_timecard.setVisibility(View.VISIBLE);
        }
    }

    // 友盟统计
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(this.getClass().getSimpleName());
        MobclickAgent.onResume(this);
    }

    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(this.getClass().getSimpleName());
        MobclickAgent.onPause(this);
    }
}
